<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">全流程甲方权重设置</ui:define>
    <ui:define name="content">
        <h:form>

            <p:dialog id="mod_weight_dialog"
                      header="权重设置" position="center" widgetVar="mod_weight_dialog" modal="true" width="85%"
                      height="90%" responsive="true" >
                <p:panelGrid columns="2"
                             columnClasses="ui-grid-col-3,ui-grid-col-9"
                             layout="grid" styleClass="ui-panelgrid-blank"
                             style="border:0px none; background-color:transparent;">
                    <p:outputLabel for="mod_status" value="在线状态"/>
                    <p:selectOneMenu id="mod_status" value="#{loanApiProductBean.productInfo.status}" >
                        <f:selectItem itemLabel="上线中" itemValue="ONLINE"  />
                        <f:selectItem itemLabel="已下线" itemValue="OFFLINE"/>
                    </p:selectOneMenu>
                    <p:outputLabel for="mod_name" value="甲方名"/>
                    <p:inputText id="mod_name" value="#{loanApiProductBean.productInfo.name}" style="width:100%"/>

                    <p:outputLabel for="mod_minlimit" value="最低额度"/>
                    <p:inputText id="mod_minlimit" value="#{loanApiProductBean.productInfo.minLimit}" style="width:100%"/>
                    <p:outputLabel for="mod_maxlimit" value="最高额度"/>
                    <p:inputText id="mod_maxlimit" value="#{loanApiProductBean.productInfo.maxLimit}" style="width:100%"/>
                    <p:outputLabel for="mod_weight" value="权重"/>
                    <p:inputText id="mod_weight" value="#{loanApiProductBean.productInfo.weight}" style="width:100%"/>

                </p:panelGrid>
                <div style="text-align:right;padding-top:20px">
                    <p:commandButton value="保存" actionListener="#{loanApiProductBean.modWeight()}" process="mod_weight_dialog" update="@form" />
                </div>
            </p:dialog>



            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"/>

                        <p:columnToggler datasource="loanApiProductDataTable" trigger="toggler"/>
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton id="search" value="查询" icon="fa fa-search"
                                         update="@form"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"
                                         actionListener="#{loanApiProductBean.onReset}"
                                         process="@this"
                                         update="@form"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <h1>查询条件</h1>
                            <p:panelGrid columns="8" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-2"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">

                                <p:outputLabel for="name" value="甲方名"/>
                                <p:inputText id="name" value="#{loanApiProductBean.$.name}"/>
                                 
                                <p:outputLabel for="status" value="在线状态"/>
                                <p:selectOneMenu id="status" value="#{loanApiProductBean.$.status}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="上线中" itemValue="1"/>
                                    <f:selectItem itemLabel="已下线" itemValue="0"/>
                                </p:selectOneMenu>
                            </p:panelGrid>
                        </div>
                        <div class="card">
                            <p:dataTable id="loanApiProductDataTable"
                                         style="width: 100%"
                                         var="loanApiProduct"
                                         value="#{loanApiProductBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="97%"
                                         reflow="true"
                                         resizableColumns="true">

                                <p:column headerText="操作">
                                    <p:splitButton icon="fa fa-pencil"
                                                   actionListener="#{loanApiProductBean.onSelect(loanApiProduct)}"
                                                   oncomplete="PF('mod_weight_dialog').show()"
                                                   process="@this" update="@form">
                                        <f:setPropertyActionListener
                                                value="/views/family/loanapiorder/weight.xhtml"
                                                target="#{currentUserBean.back}"/>
                                    </p:splitButton>
                                </p:column>
                                <p:column headerText="在线状态">
                                    <h:outputText value="上线中" rendered="#{loanApiProduct.status==1}"/>
                                    <h:outputText value="已下线" rendered="#{loanApiProduct.status==0}"/>
                                </p:column>
                                <p:column headerText="甲方名">
                                    <h:outputText value="#{loanApiProduct.name}"/>
                                </p:column>
                                <p:column headerText="最低额度">
                                    <h:outputText value="#{loanApiProduct.minlimit}"/>
                                </p:column>
                                <p:column headerText="最高额度">
                                    <h:outputText value="#{loanApiProduct.maxlimit}"/>
                                </p:column>
                                <p:column headerText="权重">
                                    <h:outputText value="#{loanApiProduct.weight}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
